<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="../dist/vue.js"></script>

<body>
    <script>
        // 响应式数据变化，数据会自动更新到视图
        // 数据的取值和赋值都是响应式的
        const vm = new Vue({
            // 代理数据
            data() {
                return {
                    msg: 'hello vue',
                    count: 100,
                    address: {
                        city: 'beijing',
                        street: 'haidian',
                    },
                    // 修改数组很少使用索引，一般使用数组方法
                    hobby: ['sing', 'dance', 'rap', { name: 'jump' }],
                }
            }
        })

        // 赋值
        vm.msg = 'hello vue2';
        vm.address = {
            city: 'shanghai',
            street: 'haidian',
        }
        console.log(vm.msg);
        console.log(vm);
        console.log(vm.count);
        vm.hobby.push({ name: 'zhaoliu' });
        console.log(vm.hobby);

    </script>
</body>

</html>